// --------------------------------------------------------------------------------------------------------------------
// <copyright file="IFeedPlugin.cs" company="Open Trader">
//   Copyright (c) David Denis (david.denis@systemathics.com)
// </copyright>
// <summary>
//   |  Open Trader - The Open Source Systematic Trading Platform
//   |
//   |  This program is free software: you can redistribute it and/or modify
//   |  it under the terms of the GNU General Public License as published by
//   |  the Free Software Foundation, either version 2 of the License, or
//   |  (at your option) any later version.
//   |
//   |  This program is distributed in the hope that it will be useful,
//   |  but WITHOUT ANY WARRANTY; without even the implied warranty of
//   |  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
//   |  GNU General Public License for more details.
//   |
//   |  You should have received a copy of the GNU General Public License
//   |  along with this program.  If not, see http://www.gnu.org/licenses
//   |
//   |  Up to date informations about Open Trader can be found at :
//   |    http://opentrader.org
//   |    http://opentrader.codeplex.com
//   |
//   |  For professional services, please visit us at :
//   |    http://www.systemathics.com
// </summary>
// --------------------------------------------------------------------------------------------------------------------

namespace Org.OpenTrader.Framework.Forge.Interfaces
{
    #region Using Directives

    using Org.OpenTrader.Framework.Forge.Events;
    using Org.OpenTrader.Framework.LiveObjects.Interfaces;

    #endregion

    /// <summary>
    /// The e emited events type.
    /// </summary>
    public enum EEmitedEventsType
    {
        /// <summary>
        /// The book events.
        /// </summary>
        BookEvents, 

        /// <summary>
        /// The quote events.
        /// </summary>
        QuoteEvents
    }

    /// <summary>
    /// Feed Plugin interface (also called Feed Handler in other projects) 
    /// </summary>
    public interface IFeedPlugin : IPlugin, ILayer
    {
        #region Properties

        /// <summary>
        /// Tells what type of event the plugin emit, there are two possibilities
        /// - QuoteEvents, for which the level is not known and we have to rebuild the market book ouverselve
        /// - BookEvents, for which the level is known and no special handling has to be done
        /// </summary>
        EEmitedEventsType EmitedEventsType { get; }

        /// <summary>
        /// Gets wether the subscriptions must be redone in case of disconnection
        /// </summary>
        bool NeedResubscriptionIfDisconnected { get; }

        /// <summary>
        /// The schema contains extra parameters that are used in conjuction with IInstrumentStaticData informations
        /// In order to be able to render IFeedPlugin interface methods. For example, if your FeedPlugin implementation
        /// is a Reuters implementation, you'll have there the RIC, for other systems maybe other fields would be needed
        /// Thus, each plugin will enforce the requirements for specific uses of instruments
        /// </summary>
        string SubscriptionConfigurationSchema { get; }

        #endregion

        #region Public Methods

        /// <summary>
        /// Open the subscription
        /// </summary>
        /// <param name="wiring">
        /// </param>
        /// <param name="handler">
        /// </param>
        /// <returns>
        /// The start subscription.
        /// </returns>
        Status StartSubscription(IFeedWiring wiring, RemotableEventHandler<FeedEventArgs> handler);

        /// <summary>
        /// HardOrSoftClosed the subscription
        /// </summary>
        /// <param name="wiring">
        /// </param>
        /// <param name="handler">
        /// </param>
        /// <returns>
        /// The stop subscription.
        /// </returns>
        Status StopSubscription(IFeedWiring wiring, RemotableEventHandler<FeedEventArgs> handler);

        #endregion
    }
}